<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    function cai(max,min){
        return Math.floor(Math.random()*(max-min+1)+min);
    }
    let date1 = cai(1,10);
    console.log(date1);
    let date2;
    while(true){
        date2 = prompt('输入你猜的数字');
        if(date2==null){
            break;
        }else if(date2>date1){
            alert('你猜大了');
        }else if(date2<date1){
            alert('你猜小了');
        }else{
            alert('恭喜喜提作业');
            break;
        }
    }
</script>
</html>